package com.tengju.bff.interfaces.covercharge.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Objects;

/**
 * 收益类型枚举
 *
 * @author zhaoyi
 */
@Getter
@AllArgsConstructor
public enum ProfitTypeEnum {

    /**
     * 批发收益入账
     */
    //todo
    pf_in(1, "批发收益入账"),
    pf_out(2, "批发收益扣除"),
    jy_in(3, "教育奖金入账"),
    jy_out(4, "教育奖金扣除"),
    team_in(5, "团队补贴入账"),
    transfer_in(6, "转入"),
    transfer_out(7, "转出"),
    ls_withdraw(8, "乐税提现"),
    ls_withdraw_refund(9, "乐税提现驳回"),
    return_pf(10, "批发收益退货扣除"),
    return_jy(11, "退货教育奖金收益扣除"),
    self_withdraw(12, "自认证提现"),
    self_withdraw_refund(13, "自认证提现驳回"),
    activity_bonus_in(14, "活动奖金入账"),
    activity_bonus_out(15, "活动奖金扣除"),
    rewards_pt_in(16, "奖惩入账"),
    rewards_pt_out(17, "奖惩扣除");

    private Integer code;
    private String desc;


    /**
     * 根据编码获取指定枚举
     *
     * @param code 编码
     * @return 结果
     */
    public static ProfitTypeEnum getInstance(Integer code) {
        if (Objects.isNull(code)) {
            return null;
        }
        for (ProfitTypeEnum typeEnum : ProfitTypeEnum.values()) {
            if (typeEnum.getCode().equals(code)) {
                return typeEnum;
            }
        }
        return null;
    }


}
